﻿using System;
using UnityEngine;

// Token: 0x0200040F RID: 1039
public class VectorUtility
{
	// Token: 0x060019ED RID: 6637 RVA: 0x000A64EC File Offset: 0x000A46EC
	public static float Vector3_ToYaw(Vector3 v)
	{
		float magnitude = v.magnitude;
		if (magnitude == 0f)
		{
			return 0f;
		}
		float y = v.x / magnitude;
		float x = v.z / magnitude;
		return Mathf.Atan2(y, x) * 57.29578f;
	}

	// Token: 0x060019EE RID: 6638 RVA: 0x000A6534 File Offset: 0x000A4734
	public static float Vector3_ToPitch(Vector3 v)
	{
		float magnitude = v.magnitude;
		if (magnitude == 0f)
		{
			return 0f;
		}
		float num = v.y / magnitude;
		num = Mathf.Clamp(num, -1f, 1f);
		return Mathf.Asin(-num) * 57.29578f;
	}

	// Token: 0x060019EF RID: 6639 RVA: 0x000A6584 File Offset: 0x000A4784
	public static void Vector3_ToYawPitch(Vector3 v, out float yaw, out float pitch)
	{
		yaw = VectorUtility.Vector3_ToYaw(v);
		pitch = VectorUtility.Vector3_ToPitch(v);
	}

	// Token: 0x060019F0 RID: 6640 RVA: 0x000A6598 File Offset: 0x000A4798
	public static Vector3 Vector3_FromYawPitch(float yaw, float pitch)
	{
		float f = pitch * 0.017453292f;
		float f2 = yaw * 0.017453292f;
		Vector3 result;
		result.x = Mathf.Cos(f) * Mathf.Sin(f2);
		result.y = -Mathf.Sin(f);
		result.z = Mathf.Cos(f) * Mathf.Cos(f2);
		result.Normalize();
		return result;
	}
}
